home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 014a / vgakit34.zip / RDPOINT.ASM < prev    next >
Assembly Source File  |  1990-05-04  |  1KB  |  66 lines

  1.  
  2.     include    model.h
  3.  
  4. ;
  5. ;    VGAKIT Version 3.4
  6. ;
  7. ;    Copyright 1988,89,90 John Bridges
  8. ;    Free for use in commercial, shareware or freeware applications
  9. ;
  10. ;    RDPOINT.ASM
  11. ;
  12. ;
  13. .data
  14.  
  15.     extrn    curbk:word
  16.     extrn    maxx:word,maxy:word
  17.  
  18. .code
  19.  
  20.     extrn    newbank:proc
  21.  
  22.     public    rdpoint
  23.     public    rdpoint13x
  24.  
  25. rdpoint    proc    xpos:word,ypos:word
  26.     mov    ax,[maxx]        ;640 dots wide in most cases
  27.     mul    [ypos]
  28.     add    ax,[xpos]
  29.     adc    dx,0
  30.     mov    bx,ax
  31.     mov    ax,dx
  32.     cmp    ax,[curbk]
  33.     jz    nonew
  34.     call    newbank            ;switch banks if a new bank entered
  35. nonew:    mov    ax,0a000h        ;setup screen segment A000
  36.     mov    es,ax
  37.     mov    al,es:[bx]
  38.     mov    ah,0
  39.     ret
  40. rdpoint    endp
  41.  
  42. rdpoint13x proc    xpos:word,ypos:word
  43.     mov    ax,[maxx]        ;360 dots wide (for 360x480 mode)
  44.     shr    ax,1
  45.     shr    ax,1
  46.     mul    [ypos]
  47.     mov    bx,[xpos]
  48.     mov    cl,bl
  49.     shr    bx,1
  50.     shr    bx,1
  51.     add    bx,ax
  52.     mov    ah,cl
  53.     and    ah,3
  54.     mov    al,4
  55.     mov    dx,3ceh
  56.     out    dx,ax            ;set EGA bit plane read register
  57.     mov    ax,0a000h        ;setup screen segment A000
  58.     mov    es,ax
  59.     mov    al,es:[bx]
  60.     mov    ah,0
  61.     ret
  62. rdpoint13x endp
  63.  
  64.     end
  65.  
  66.